<template>
  <van-overlay :show="visible" z-index="9999" class="global-loading-overlay">
    <div class="global-loading-container">
      <van-loading :size="size" :color="color" vertical>
        <template #default>
          <div v-if="message" class="loading-message">{{ message }}</div>
        </template>
      </van-loading>
    </div>
  </van-overlay>
</template>

<script setup>
defineProps({
  visible: {
    type: Boolean,
    default: false
  },
  message: {
    type: String,
    default: ''
  },
  size: {
    type: String,
    default: '32px'
  },
  color: {
    type: String,
    default: '#7C96A6'
  }
})
</script>

<style scoped>
:deep(.global-loading-overlay) {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background-color: rgba(0, 0, 0, 0.7) !important;
  z-index: 99999 !important;
}

.global-loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  border-radius: 8px;
  background-color: rgba(255, 255, 255, 0.95);
  min-width: 120px;
  min-height: 120px;
}

.loading-message {
  margin-top: 12px;
  font-size: 14px;
  color: #323233;
  text-align: center;
  line-height: 1.5;
}
</style>

